import { CrossBossDropTipInfo } from "../../resource/info/CrossBossDropTipInfo";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { ItemData } from "../../resource/info/ItemData";
import { CrossBossDropItem } from "./CrossBossDropItem";
import { ObjCreate } from "../common/ObjCreate";
import { BaseItem } from "../common/BaseItem";
import { ImagesConst } from "../../resource/ImagesConst";
import { Language } from "../../../../extend/language/Language";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
//class CrossBossDropTipRender
    
    export  class CrossBossDropTipRender /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initView();
            return;
        }

        public set data(arg1)
        {
            var loc3=null;
            var loc10=null;
            var loc11=null;
            var loc12=0;
            if (arg1 == null) 
            {
                return;
            }
            this._data = arg1 as CrossBossDropTipInfo;
            this._txtBossName.htmlText = this._data.bossName;
            var loc1=this._data.mainDropArr;
            var loc2=loc1[0];
            loc3 = loc1.length > 1 ? loc1[1] : null;
            var loc4=GlobalStyle.color1;
            var loc5=loc2.split("#");
            this._txtMainDropNum1.htmlText = loc5[1] + HTMLUtil.addColor(loc5[2], loc4) + loc5[3];
            var loc6=new ItemData(int(loc5[0]));
            this._mainDrop1.itemData = loc6;
            this._mainDrop1.amount = 1;
            if (loc3) 
            {
                this._otherDropsBox.y = 42;
                if (!this._mainDrop2) 
                {
                    this._mainDrop2 = new CrossBossDropItem();
                    this._mainDrop2.x = 83;
                    this._mainDrop2.y = 120;
                }
                this.addChild(this._mainDrop2);
                loc10 = loc3.split("#");
                this._txtMainDropNum2 = ObjCreate.createGTextField("", 124, 127, 150, 20, this, GlobalStyle.textFormat6);
                this._txtMainDropNum2.htmlText = loc10[1] + HTMLUtil.addColor(loc10[2], loc4) + loc10[3];
                loc6 = new ItemData(int(loc10[0]));
                this._mainDrop2.itemData = loc6;
                this._mainDrop2.amount = 1;
            }
            else if (this._mainDrop2 && this._mainDrop2.parent) 
            {
                this.removeChild(this._mainDrop2);
            }
            var loc7;
            var loc8=(loc7 = this._data.otherDropArr).length;
            var loc9=0;
            while (loc9 < 6) 
            {
                (loc11 = this._otherDrops[loc9] as BaseItem).visible = false;
                if (!(loc9 >= loc8)) 
                {
                    loc11.visible = true;
                    loc12 = int(loc7[loc9]);
                    loc11.itemData = new ItemData(loc12);
                    loc11.amount = 1;
                }
                ++loc9;
            }
            return;
        }

        public /* override */ get height(): number
        {
            if (this._mainDrop2 && this._mainDrop2.parent) 
            {
                return this._otherDropsBox.y + 180;
            }
            return 180;
        }

        public /* override */ get width(): number
        {
            return 355;
        }

        /* internal  */initView(): void
        {
            var loc4=null;
            ObjCreate.createBg(20, 64, 315, 1, this, ImagesConst.SplitLine);
            this._title = ObjCreate.createGTextField("", 0, 8, 355, 20, this);
            var loc1=this._title.defaultTextFormat;
            loc1.size = 16;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            loc1.bold = true;
            this._title.defaultTextFormat = loc1;
            this._title.htmlText = Language.getString(85004);
            this._txtBossName = ObjCreate.createGTextField("", 20, 38, 300, 20, this, GlobalStyle.textFormat6);
            this._mainDrop1 = new CrossBossDropItem();
            this._mainDrop1.x = 83;
            this._mainDrop1.y = 76;
            this.addChild(this._mainDrop1);
            var loc2=ObjCreate.createGTextField("", 20, 85, 200, 20, this);
            loc2.htmlText = Language.getString(85005);
            this._txtMainDropNum1 = ObjCreate.createGTextField("", 124, 85, 150, 20, this, GlobalStyle.textFormat6);
            this._otherDropsBox = new Object /* flash.display.Sprite */();
            this.addChild(this._otherDropsBox);
            ObjCreate.createBg(20, 121, 315, 1, this._otherDropsBox, ImagesConst.SplitLine);
            loc2 = ObjCreate.createGTextField("", 20, 147, 200, 20, this._otherDropsBox);
            loc2.htmlText = Language.getString(85006);
            this._otherDrops = [];
            var loc3=0;
            while (loc3 < 6) 
            {
                (loc4 = new CrossBossDropItem()).x = 83 + loc3 * 42;
                loc4.y = 134;
                this._otherDropsBox.addChild(loc4);
                this._otherDrops.push(loc4);
                ++loc3;
            }
            return;
        }

        /* internal */ /* var */_data: CrossBossDropTipInfo;

        /* internal */ /* var */_txtBossName: GTextFiled;

        /* internal */ /* var */_txtMainDropNum1: GTextFiled;

        /* internal */ /* var */_txtMainDropNum2: GTextFiled;

        /* internal */ /* var */_txtMainDrop: GTextFiled;

        /* internal */ /* var */_mainDrop1: CrossBossDropItem;

        /* internal */ /* var */_mainDrop2: CrossBossDropItem;

        /* internal */ /* var */_otherDrops: Array<any>;

        /* internal */ /* var */_title: GTextFiled;

        /* internal */ /* var */_otherDropsBox: Object /* flash.display.Sprite */;
    }
